package it.polito.connectedcar.trafficlight;

import java.util.List;

/**
 * The SourceTrafficLightProxy is an abstraction for connecting to a source
 * entity generating the data ( either a simulated or a real one). A
 * SourceTrafficLightProxy contains a {@link TrafficLightUpdateDelegate}
 * interface which must be implemented by users high level business logic
 * classes in order to be informed when something changed in the sourceEntity.
 * 
 * @author Nicola Aresta
 * 
 */
public abstract class SourceTrafficLightProxy {

	private TrafficLightUpdateDelegate delegate;

	public TrafficLightUpdateDelegate getDelegate() {
		return delegate;
	}

	public void setDelegate(TrafficLightUpdateDelegate delegate) {
		this.delegate = delegate;
	}

	/**
	 * 
	 * @return the index of the current phase of the traffic light with respect
	 *         to the whole program, which is a sequence of phases
	 */
	public abstract int getCurrentPhase();

	/**
	 * The time when the traffic light is assumed to change its current phase
	 * can change depending on the type of traffic light (adaptive o static)
	 * 
	 * @return the absolute time when the trafficLight is supposed to change its
	 *         current phase.
	 * 
	 */
	public abstract long getAssumedTimeToNextSwitch();

	/**
	 * A traffic light managed a set of lanes( incoming,outgoing and internal )
	 * 
	 * @return
	 */
	public abstract List<String> getControlledLanes();

	/**
	 * A traffic light managed a set of links connecting roads (
	 * incoming,outgoing and internal )
	 * 
	 * @return
	 */
	public abstract List<String> getControlledLinks();

	/**
	 * 
	 * @return the unique ID of the traffic light in the system
	 */
	public abstract String getId();

	/**
	 * Not used anymore . See {@link ConnectedTLProgram} for more details about
	 * a TL program
	 * 
	 * @return
	 */
	@Deprecated
	public abstract String getTlProgram();

}
